<?php
/**
 * Created by PhpStorm.
 * User: alice
 * Date: 2016/1/14
 * Time: 11:06
 */

class Involved_AdsModel extends BaseModel{

    protected $table = 'ads';

    #APP
    public function GetAdsList($type)
    {
        $info = DB::table($this->table)
                ->select('ads_id','ads_name','img','link')
                ->where('type',$type)
                ->get();
        foreach($info as $k => $v){
            $v->img = $v->img;
        }
        return $info;
    }



    #PC

    /**
     * 广告图列表
     * @author  alice
     * @date    2016-1-19
     * @return mixed
     */
    public function ShowAdsList()
    {
        return DB::table($this->table)->paginate(8);
    }

    /**
     * 广告图详情
     * @param $id
     * @author  alice
     * @date    2016-1-19
     * @return mixed
     */
    public function ShowAdsInfo($id)
    {
        return DB::table($this->table)->where('ads_id',$id)->first();
    }
    public function AdsList()
    {
        return  DB::table($this->table)->get();
    }

    public function GetAdsInfo($ads_id)
    {
        return DB::table($this->table)->where('ads_id',$ads_id)->first();
    }

}